import React, { useEffect, useState } from "react"
import { Spin } from "antd"
import { get } from "@/utils/request"
import { DayLogCountItem, PageDataListItem } from "@/models/result-item"
import { MainChart } from "./main-chart"
import { RealtimeLog } from "./realtime-log"

interface PageManageData {
  list: DayLogCountItem[]
}

const PageManage: React.FC = () => {
  const [loading, setLoading] = useState(false)
  const [data, setData] = useState<PageManageData>()

  useEffect(() => {
    setLoading(true)
    get<PageManageData>("/pegasus/api/log/get_emits_statistics/").then(
      (res) => {
        setData(res?.data)
        setLoading(false)
      }
    )
  }, [])

  return (
    <Spin spinning={loading}>
      <MainChart />
      <RealtimeLog />
    </Spin>
  )
}

export default PageManage
